# -*- coding: utf-8 -*-
from Page.insuredmtPage import insuredmtPage
import time
import os
class insuredmt():
    def __init__(self,driver):
        self.driver=driver
        self.insuredmtPage=insuredmtPage(self.driver)
    def insuredmaintence(self):
        self.insuredmtPage.btnInsuredMaintence().click()
        time.sleep(1)
    def query_insuredmt(self,GrpPropNo):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.insuredmtPage.inpGrpPropNo().send_keys(GrpPropNo)
        time.sleep(1)
        self.insuredmtPage.btnQuery().click()
        time.sleep(1)
    def self_to_thepublic(self):
        # 公共池
        self.insuredmtPage.btnInsuredListGridSel().click()
        time.sleep(1)
        self.insuredmtPage.btnApply().click()
        time.sleep(1)
        window1 = self.driver.window_handles
        self.driver.switch_to.window(window1[-1])
        self.noscanningPage.butSubmit().click()
        # 个人池
        windows2 = self.driver.window_handles
        self.driver.switch_to.window(windows2[-1])
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.insuredmtPage.btnSelfInsuredListGridSel().click()
        time.sleep(1)
        self.insuredmtPage.btnGoInside().click()
        time.sleep(1)
        windows3 = self.driver.window_handles
        self.driver.switch_to.window(windows3[-1])
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
    def upload_InsuredList(self):
        self.insuredmtPage.btnImportInsuredList().click()
        time.sleep(1)
        windows1 = self.driver.window_handles
        self.driver.switch_to.window(windows1[-1])
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.insuredmtPage.btnImportPath().click()
        time.sleep(1)
        os.system(r'C:\Users\tanjm.ext\PycharmProjects\GroupL\TestData\uploadList.exe')
        time.sleep(1)
        self.insuredmtPage.btnImport().click()
        time.sleep(2)
        window2 = self.driver.window_handles
        self.driver.switch_to.window(window2[-1])
        self.noscanningPage.butSubmit().click()
        time.sleep(1)
        window3 = self.driver.window_handles
        self.driver.switch_to.window(window3[-1])
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.insuredmtPage.btnClose().click()
        time.sleep(1)
        window4 = self.driver.window_handles
        self.driver.switch_to.window(window4[-1])
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.insuredmtPage.btnInsuredListCf().click()
        time.sleep(1)
        window2 = self.driver.window_handles
        self.driver.switch_to.window(window2[-1])
        self.noscanningPage.butSubmit().click()
        time.sleep(1)








